<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        const str = 'hjhjhkljkjiuoiusssssjkjkljklsssyuyoweressss';
        const arr = str.split('');
        const obj = arr.reduce((prev,cur) => {
            prev[cur] ? prev[cur]++ : (prev[cur] = 1);
            return prev;
        },{});
        let maxVal = '';
        let maxNum = 0;
        Object.keys(obj).forEach(key => {
            if(maxNum<obj[key]) {
                maxNum = obj[key];
                maxVal = key;
            }
        });
        console.log('出现次数最多的字符:',maxVal,'出现的次数:',maxNum);
    </script>
</body>
</html>